// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'

// 引入页面组件

// 定义路由
const routes = [
  { 
    path: '/', 
    component: () => import('../layout/index.vue'),
    children: [
      { path: '', component: () => import('../views/Buttons.vue') },
      { path: 'cards', component: () => import('../views/Cards.vue') },
      { path: 'checkboxes', component: () => import('../views/CheckBox.vue') },
      { path: 'forms', component: () => import('../views/Forms.vue') },
      { path: 'inputs', component: () => import('../views/Input.vue') },
      { path: 'loadings', component: () => import('../views/Loadings.vue') },
      { path: 'radio-button', component: () => import('../views/RadioButton.vue') },
      { path: 'toggle-switch', component: () => import('../views/ToggleSwitch.vue') },
      { path: 'tooltips', component: () => import('../views/Tooltips.vue') },
      { path: 'preview/:name', component: () => import('../views/ComponentPreview.vue') },
    ]
  },
]

// 创建路由器实例
const router = createRouter({
  history: createWebHistory(), // 使用 HTML5 history 模式
  routes
})

export default router